<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #allmessage{
            width: 400px;
            height: 500px;
            background-color: rgb(206, 144, 144);
        }
    </style>
</head>
<body>
    
    <div id="allmessage"></div><br/>
    请输入你的想法:
    <input id="textId" type="text">
    <input type="button" value="发送" onclick="send()">
    <script>
        // 需求:不能包含敏感词
        var says=[];
        function send(){
            var str=minGan(document.getElementById("textId").value);
            says.push(str);
            document.getElementById("allmessage").innerHTML += str +"<br/>";
            document.getElementById("textId").value="";
        }
               function minGan(str){
                var minGans=["滚","sb","憨憨"];
                var resultStr=str;
                for(var i=0;i<str.length;i++){
                    resultStr=resultStr.replaceAll(minGans[i],"**")
                }
                return  resultStr;
               }
    </script> 
</body>
</html>




